﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/list.css" type="text/css" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/Orange.css" rel="stylesheet" type="text/css" />

    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>

    <script src="bootstrap/iCheck-master/icheck.js"></script>
    <script src="js/common.js"></script>
    <script src="js/PageIndex.js"></script>
    <script src="http://dn-blqw.qbox.me/kk.js"></script>
    <script src="js/WdatePicker.js"></script>
    <script src="Scripts/jquery.iDialog.js" dialog-theme="default"></script>
    <style>
        .from-control {
            width: 350px;
            margin: 10px 20px;
        }

        .page {
            margin: 15px 20px 15px 0;
            height: 30px;
        }

            .page li {
                min-width: 30px;
                height: 30px;
                line-height: 30px;
                margin-right: 10px;
                border-radius: 3px;
            }

                .page li.page_ic {
                    width: 120px;
                    color: #666666;
                    border: 0 none;
                }

                    .page li.page_ic:hover {
                        color: #666666;
                    }

        .page_ic input {
            width: 44px;
            height: 30px;
            line-height: 30px;
            border: 1px solid #e6e6e6;
            text-align: center;
            border-radius: 3px;
        }

        .page li.page_last {
            cursor: pointer;
            border-color: #0074d9;
            background: #0074d9;
            color: #fff;
            width: 40px;
        }

        .page_num {
            float: left;
            margin: 15px 0 15px 20px;
            height: 30px;
            line-height: 30px;
            font-size: 14px;
            color: #666666;
        }

            .page_num select {
                border: 1px solid #e6e6e6;
                border-radius: 3px;
            }
    </style>
</head>
<body style="background: #f1f1f1;">
    <div class="main01">
        <div class="content clearfix">
            <div class="headline02">
                <div class="line_left">兑吧订单</div>
                <div class="line_right">
                    <ul class="nav_line_right">
                        <li class="con"><a href="#">首页</a></li>
                        <li>/</li>
                        <li class="con"><a href="#">订单管理</a></li>
                        <li>/</li>
                        <li class="con"><a href="#" style="color: #60b12a;">兑吧订单</a></li>
                    </ul>
                </div>
            </div>
            <div class="bton">
                <div class="bton_left">
                    <select id="F_CityKid" class="selall sel100 fl" style="margin-right:11px;margin-top:5px;margin-left:11px;">
                        <option value="-1">-选择城市-</option>
                    </select>
                    <!--<select id="F_Status" class="selall sel100 fl" style="margin-right:11px;margin-top:5px;width:110px;">
                        <option value="-1">审核状态</option>
                        <option value="0">未审核</option>
                        <option value="1">审核通过</option>
                        <option value="2">审核未通过</option>
                        <option value="3">不需要审核</option>
                    </select>-->
                    <select id="F_Type" class="selall sel100 fl" style="margin-right: 11px;margin-top:5px">
                        <option value="">商品类型</option>
                        <option value="alipay">支付宝</option>
                        <option value="qb">Q币</option>
                        <option value="coupon">优惠券</option>
                        <option value="object">实物商品</option>
                        <option value="phonebill">话费</option>
                        <option value="phoneflow">流量</option>
                        <option value="virtual">虚拟商品</option>
                        <option value="turntable">大转盘</option>
                        <option value="singleLottery">单品抽奖</option>
                        <option value="hdtoolLottery">活动抽奖</option>
                        <option value="manualLottery">手动抽奖</option>
                        <option value="gameLottery">游戏</option>
                    </select>
                </div>
                    

                <div class="bton_right" style="margin-top:5px;">
                    <div class="bton_left_nav">
                        <a href="" class="btn_select" id="selboxbt">筛选</a>                           
                        <a href="javascript:document.location.reload();" class="btn_refresh" id="refresh">刷新</a>      
                        <a href="#" class="btn_export" onclick="f_ExportExcel()" style="border:1px solid #e3e4e6;">导出</a>
                        <a href="" id="DownLoad" target="_blank" class="btn_export" style="display:none">下载</a>             
                    </div>
                    <div class="bton_left_nav pageIn2">                        
                    </div>
                </div>
            </div>
        </div>


        <div style="min-height: 500px;">
            <table class="table03 tab_warp" style="width: 100%; max-height: 400px; table-layout: fixed; border-bottom: 1px #e6e6e6 solid;">
                <thead>
                    <tr class="info_title">
                        <th style="width: 60px" class="mid_line">序号</th>
                        <th style="width: 100px;" class="mid_line">城市</th>
                        <th style="width: 150px" class="mid_line">兑吧订单号</th>
                        <th style="width: 70px;" class="mid_line">订单状态</th>
                        <th style="width: 120px;" class="mid_line">商品名称</th>
                        <th style="width: 70px;" class="mid_line">消耗积分</th>
                        <th style="width: 70px;" class="mid_line">商品类型</th>
                        <th style="width: 120px" class="mid_line">订单时间</th>
                        <th style="width: 100px;" class="mid_line">用户名</th>
                        <th style="width: 100px;" class="mid_line">联系电话</th>
                        <!--<th style="width: 70px;" class="mid_line">审核状态</th>
                        <th style="width: 200px">操作</th>-->
                    </tr>
                </thead>
                <tbody>
                    <tr class="info_cont" style="display:none">
                        <td>{F_Index}</td>
                        <td>{CityName}</td>
                        <td>{DuibaOrderNum}</td>
                        <td>{State}</td>
                        <td>{Description}</td>
                        <td>{Credits}</td>
                        <td>{ProductType}</td>
                        <td>{CreateTime}</td>
                        <td>{UserName}</td>
                        <td>{Phone}</td>
                        <!--<td>{AuditStatus}</td>
                        <td>
                            <div class="reset">
                                {IsStatus}
                            </div>
                        </td>-->
                    </tr>
                </tbody>
            </table>
            <!--放置分页 begin -->
            <table style="width: 100%; height: auto">
                <tr>
                    <td colspan="15">
                        <div class="pageIn"></div>
                    </td>
                </tr>
            </table>
            <!--放置分页 end -->
        </div>
    </div>

     <div id="selbox" class="clearfix" style="display:none">
        <div class="clearfix">
            <input type="text" style="margin-top:50px;" class="selall sel100 fl from-control" id="orderNum" placeholder="订单号" max="25" onkeypress="if (event.which == 13) { clearNoPhone_Number($('#orderNum').val()); this.blur(); }" />
            <input type="text" style="margin-top:50px;" class="selall sel100 fl from-control" id="brokerPhone" placeholder="经纪人电话" onkeyup="clearNoPhone_Number(this)" maxlength="11" onkeypress="if (event.which==13) { clearNoPhone_Number($('#brokerPhone').val()); this.blur(); }" />
        </div>
         <div class="datatime">
             <input type="text" id="beginTime" name="beginTime" value="" onclick="WdatePicker()" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" placeholder=" 请选择开始时间"
                    style="line-height:28px;border:1px solid #e3e4e6;" class="from-control" />
             <input type="text" id="endTime" name="endTime" value="" onclick="WdatePicker()" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'beginTime\')}' })" placeholder=" 请选择结束时间"
                    style="line-height:28px;border:1px solid #e3e4e6;margin-left:15px;" class="from-control" />
         </div>
     </div>

    <script src="js/list.js"></script>
    <script src="js/Page_New.js"></script>
    <script type="text/javascript">
        kk.api.baseUrl = "/";

        $(function () {
            f_GetData(1);
            f_GetCityList();
            countwidth();
        });

        $("#selboxbt").click(function () {
            showWindows("高级搜索", "selbox", f_Search, 800, 300);
            return false;
        })

        $("#F_CityKid").on('change', function () {
            f_Search();
        })

        $("#F_Type").on('change', function () {
            f_Search();
        })

        $("#F_Status").on('change', function () {
            f_Search();
        })

        function showWindows(title, id, func, wt, h) {
            $.dialog({
                height: h,
                width: wt,
                fixed: true,
                lock: true,
                title: title,
                content: document.getElementById(id),
                btn: {                      //可以任意定义按钮个数
                    ok: {                     //按钮的key值，下次可用个btn方法从新设置
                        val: '确定',  //按钮显示的文本
                        type: 'orange',
                        click: function () {
                            func();
                        }
                    },
                    canle: {                     //按钮的key值，下次可用个btn方法从新设置
                        val: '取消',
                    }
                },
                init: function () {

                },
            });

        }

        function countwidth() {
            if (!$(".tab_warp").length) { return }
            var widthall = 0;
            var thall = $(".tab_warp th");
            for (var i = 0; i < thall.length; i++) {
                widthall = widthall + thall.eq(i).width();
            }
            if (widthall <= $("body").width() - 60) { widthall = $("body").width() - 60 }
            $(".main01").width(widthall);
        }


        var PageIndex = 1;
        function f_Search() {
            pageIndex = 1;
            f_GetData(pageIndex);
        }

        function f_UrlParStr() {
            var type = $("#F_Type option:selected").val();
            var city = $("#F_CityKid option:selected").val();
            var state = $("#F_Status option:selected").val();
            var orderNum = $("#orderNum").val();
            var brokerPhone = $("#brokerPhone").val();
            var sdt = $("#beginTime").val();
            var edt = $("#endTime").val();
         
            //return "?state=" + state + "&orderNum=" + orderNum + "&city=" + city + "&type=" + type + "&phone=" + brokerPhone+ "&start=" + sdt + "&end=" + edt;
            return "?&orderNum=" + orderNum + "&city=" + city + "&type=" + type + "&phone=" + brokerPhone
            + "&start=" + sdt + "&end=" + edt;
        }

        //获取记录信息
        function f_GetData(pageIndex) {
            var pageSize = $("#selectedPageSize").val()||10;
            var idx = 0;
            var newUrlParStr = f_UrlParStr();
            $kk.api.get("duiba/GetOrderList/"  + newUrlParStr , { pageSize: pageSize, pageIndex: pageIndex, stamp: Math.random() }, function (res) {

                kk.fillTable(".table03", res.Items, function (data, name) {
                    if (name == "F_Index") {
                        idx++;
                        var otherCount = pageSize * (pageIndex - 1);
                        if (isNaN(otherCount)) {
                            otherCount = 0;
                        }
                        return idx + otherCount;
                    }
                    if (name == "State") {
                        switch (data[name]) {
                            case 0: return "待更新审核";
                            case 1: return "<div class='icon_oa color_green'>成功</div>";
                            case 2: return "<div class='icon_oa color_red'>失败</div>"
                        }
                    }
                    if (name == "AuditStatus") {
                        switch (data[name]) {
                            case 0: return "未审核";
                            case 1: return "<div class='icon_oa color_green'>审核通过</div>";
                            case 2: return "<div class='icon_oa color_red'>不通过</div>"
                            case 3: return "无需审核";

                        }
                    }
                    if (name == "IsStatus") {
                        switch (data["AuditStatus"]) {
                            case 0:
                                return "<a href=\"javascript:;\" onclick=\"f_Audit(\'" + data["DuibaOrderNum"] + "\',false)\" class=\"btn_revise\">审核不通过</a>"
                                    + "<a href=\"javascript:;\" onclick=\"f_Audit(\'" + data["DuibaOrderNum"] + "\',true)\" class=\"btn_revise\">审核通过</a>";
                        }
                    }
                    if(name == "ProductType")
                    {
                        switch(data["ProductType"])
                        {
                            case "alipay":return "支付宝";
                            case "qb": return "Q币";
                            case "coupon": return "优惠券";
                            case "object": return "实物商品";
                            case "phonebill": return "话费";
                            case "phoneflow": return "流量";
                            case "virtual": return "虚拟商品";
                            case "turntable": return "大转盘";
                            case "singleLottery": return "单品抽奖";
                            case "hdtoolLottery": return "活动抽奖";
                            case "manualLottery": return "手动开奖";
                            case "gameLottery": return "游戏";
                            default: return "";
                        }
                    }

                });
                $("#RecordCount").html(res.Count);
                makePageBar(f_GetData, res.Count, pageIndex, pageSize);
                PageIndex = pageIndex;
                $(':checkbox').not(".notneeddraw").iCheck({
                    checkboxClass: 'icheckbox_minimal-orange',
                    radioClass: 'iradio_minimal-orange',
                    increaseArea: '20%' // optional
                });
                $('#checkAll').css('display', 'block');
                $('.info_title .iCheck-helper').on('click', function () {
                    if ($(".icheckbox_minimal-orange:first").hasClass("checked")) {
                        $('.subBox').iCheck('check');
                    } else {
                        $('.subBox').iCheck('uncheck');
                    }
                });
                $('.pageIn').on('click', function () {
                    $('.checked:first').iCheck('uncheck');
                })
            });
        }

        //审核
        function f_Audit(DuibaOrderNum, status) {
            kk.confirm("确定审核吗？", "提示", "", "", function () {
                kk.api.get("duiba/AuditOrder", { duibaOrderNum: DuibaOrderNum, IsApproved: status }, function (res) {
                    if (res) {
                        $kk.popup("操作成功", "success", 1000);
                        f_GetData(PageIndex);
                    } else {
                        $kk.popup("操作失败", "danger", 1000);
                    }
                });
            }, null);
        }

        //城市列表
        function f_GetCityList() {
            var data = kk.api.get("System/GetCityList", function (data) {
                $("#F_CityKid").empty();
                $.each(data, function (i, obj) {
                    $("#F_CityKid").append("<option value='" + obj.F_CityKid + "'>" + obj.F_CityName + "</option>");
                });
            });

        }

        //导出excel
        function f_ExportExcel() {
            var newUrlParStr = f_UrlParStr();
            $kk.api.get("Duiba/Export" + newUrlParStr, function (res) {
                $("#DownLoad").attr("href", res)
                $("#DownLoad").show();
            });
        }

    </script>
</body>
</html>
